package com.demo.web;

import com.demo.annotation.AutoWired;
import com.demo.annotation.Component;
import com.demo.annotation.Qualifier;
import com.demo.entity.Echo;
import com.demo.entity.Person;
import com.demo.web.annotation.Controller;
import com.demo.web.annotation.RequestMapping;
import com.demo.web.annotation.RequestParam;
import com.demo.web.webenum.RequestType;

@Controller
@RequestMapping("/user")
public class WebTest {
    @AutoWired
    private Echo echo;

    public Echo getEcho() {
        return echo;
    }

    public void setEcho(Echo echo) {
        this.echo = echo;
    }

    @RequestMapping(value = "login",type = RequestType.GET)
    public void method1(){
        echo.echo("login");
        System.out.println("method1");
    }
    @RequestMapping(value = "haha",type = RequestType.POST)
    public String method2(@RequestParam("person")Person  person,@RequestParam("ha")String ha,@RequestParam("str")String str){
        String ret = "controller 接收到的数据是 "+person.toString()+" ha is "+ha+" str is "+str;
        return ret;
    }
    @RequestMapping(value = "getParamTest",type = RequestType.POST)
    public String method3(@RequestParam("word")String word,@RequestParam("person") Person person){
        System.out.println("word = " + word);
        return person.toString();
    }
}
